package com.xxxx.server.controller;


import com.xxxx.server.base.BaseQuery;
import com.xxxx.server.po.EmployeeVo;
import com.xxxx.server.pojo.*;
import com.xxxx.server.service.IEmployeeService;
import com.xxxx.server.service.INationService;
import com.xxxx.server.service.impl.JoblevelServiceImpl;
import com.xxxx.server.service.impl.NationServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.Na;
import org.apache.tomcat.jni.File;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhoubin
 */
@RestController
@RequestMapping("/employee/basic")
public class EmployeeController {
    @Autowired
    private IEmployeeService iEmployeeService;


    //进入查询用户列表功能
    @GetMapping()
    public Map<String,Object> selectAllList(EmployeeVo vo){
        Map<String,Object> map=iEmployeeService.selectAllList(vo);
        return map;
    }
    //单个删除用户功能
    @DeleteMapping("/{id}")
    public RespBean deleteUser(@PathVariable Integer id){
        iEmployeeService.deleteUser(id);
        RespBean respBean=new RespBean();
        return respBean.success("删除成功！");
    }


    // 添加用户功能
//    @GetMapping("/maxWorkID")
//    public RespBean addUser(Employee e){
//        iEmployeeService.addUser(e);
//        RespBean respBean=new RespBean();
//        return respBean.success("添加成功！");
//    }

    //查询工号
    @GetMapping("/maxWorkID")
    public Map<String,Object> selectWorkId(){
        List<Employee> list=iEmployeeService.selectWorkId();

        Map<String,Object> map=new HashMap<>();
        map.put("obj",list.get(list.size()-1).getWorkID());
        return map;
    }
    //查询职称
    @GetMapping("/joblevels")
    public List<Joblevel> selectJobLevels(){

        return iEmployeeService.selectJobLevels();
    }

    //查询民族
    @GetMapping("/nations")
    public List<Nation> selectNation(){
        return iEmployeeService.selectNation();
    }

    //查询政治面貌
    @GetMapping("/politicsstatus")
    public List<PoliticsStatus> selectPoliticsStatus(){
        return iEmployeeService.selectPoliticsStatus();
    }

    //查询所属部门
    @GetMapping("/deps")
    public List<Department> selectDepartment(){
        return iEmployeeService.selectDepartment();
    }

    //查询职位
    @GetMapping("/positions")
    public List<Position> selectPosition(){
        return iEmployeeService.selectPosition();
    }


    //导入文件
    @PostMapping("/import")
    public RespBean importFile(File file){

        return null;
    }

    //导出文件
    @GetMapping("/export")
    public RespBean exportFile(){

        return null;
    }
}
